package com.swak.pdf;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;

/**
 * Pdf 转 Excel
 * 
 * @author 618lf
 */
public class Pdf2Excel {

	public static void main(String[] args) throws IOException {
		File file = new File("D:\\学习\\李海明\\项目管理\\各地电价、光伏资源基础数据\\大工业电价.pdf");
		PDDocument doc = PDDocument.load(file);
		PDFTextStripper textStripper = new PDFTextStripper();
		String s = textStripper.getText(doc);
		StringReader reader = new StringReader(s);
		BufferedReader breader = new BufferedReader(reader);
		String line = breader.readLine();
		while (line != null) {
			System.out.println(line);
			line = breader.readLine();
			String[] datas = line.split(" ");
			System.out.println(datas);
		}
	}
}
